<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>while do..while 验证用户名和密码</title>
    <script>
        var username = prompt('请输入用户名')
        var password = prompt('请输入密码')
        while (username != 'admin' && password != '123456') {
            alert("用户名或密码错误")
            username = prompt('请输入用户名')
            password = prompt('请输入密码')
        }
        alert('登录成功')
    </script>
</head>

<body>

</body>

</html>